-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bind out CRC64 #662
Bind out CRC64 #662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix & ship
include/aws/crt/checksum/CRC.h
Outdated
* Selects a suitable implementation based on hardware capabilities. | ||
* Pass previousCRC32 if updating a running checksum. | ||
*/ | ||
uint32_t AWS_CRT_CPP_API ComputeCRC32(const ByteCursor &input, uint32_t previousCRC32 = 0) noexcept; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: pass trivial view-types by value
uint32_t AWS_CRT_CPP_API ComputeCRC32(const ByteCursor &input, uint32_t previousCRC32 = 0) noexcept; | |
uint32_t AWS_CRT_CPP_API ComputeCRC32(ByteCursor input, uint32_t previousCRC32 = 0) noexcept; |
This stackoverflow post agrees
And we've had lots of annoying C code where a byte-cursor was passed by pointer, so you need to make a tmp before calling that function, like:
struct aws_byte_cursor tmp = aws_byte_cursor_from_buf(data_as_buf); // ugh
aws_compute_crc32(&tmp, 0);
vastly better to pass by value
aws_compute_crc32(aws_byte_cursor_from_buf(data_as_buf), 0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. blindly copied hash interface here without thinking too much
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.